<!-- components/Header.vue -->
<template>
  <header class="header">
    <div class="header-left">
      <span class="header-title">机器人之家</span>
      <span class="weather">🌤 北京 25℃</span>
    </div>
    <div class="header-tools">
      <input
          type="text"
          class="search-box"
          placeholder="搜索车型/品牌"
          v-model="searchKeyword"
      >
      <button class="login-btn" @click="handleLogin">
        {{ isLoggedIn ? '用户中心' : '登录/注册' }}
      </button>
    </div>
  </header>
</template>

<script setup>
import { ref } from 'vue'

const searchKeyword = ref('')
const isLoggedIn = ref(false)

const handleLogin = () => {
  // 登录逻辑
  isLoggedIn.value = !isLoggedIn.value
}
</script>

<style scoped>
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: #333;
  color: white;
  padding: 10px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.header-title {
  font-size: 24px;
  font-weight: bold;
}

.weather {
  font-size: 14px;
}

.header-tools {
  display: flex;
  gap: 20px;
  align-items: center;
}

.search-box {
  padding: 5px 10px;
  border-radius: 15px;
  border: 1px solid #666;
  min-width: 200px;
}

.login-btn {
  background: #f60;
  color: white;
  border: none;
  padding: 8px 20px;
  border-radius: 15px;
  cursor: pointer;
}
</style>